package cn.telling.tianlianproduct.sellerbaseprice.service.impl;

import java.math.BigDecimal;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;

import cn.telling.tianlianproduct.sellerbaseprice.dao.SellerBasePriceMapper;
import cn.telling.tianlianproduct.sellerbaseprice.service.ISellerBasePrice;
import cn.telling.tianlianproduct.sellerbaseprice.vo.SearchConditionVo;
import cn.telling.tianlianproduct.sellerbaseprice.vo.SellerBasePriceVo;

/**
 * 
 * @ClassName: SellerBasePriceImpl 
 * @Description: 安全价格业务接口的实现
 * @author 陈赟 
 * @date 2015年9月24日 下午4:41:23 
 *
 */
@Service("sellerBasePriceServiceTianlian")
public class SellerBasePriceImpl implements ISellerBasePrice {
    
    @Autowired
    @Qualifier("sellerBasePriceMapper")
    private SellerBasePriceMapper sellerBasePriceMapper;

    @Override
    public SellerBasePriceVo getSellerBasePriceBySupplyIdAndProductId(String supplyId, String productId) {
        return sellerBasePriceMapper.findSellerBasePriceBySupplyIdAndProductId(supplyId, productId);
    }

	@Override
	public List<SellerBasePriceVo> getSellerBasePriceList(SearchConditionVo ConditionVo) {
	
		return sellerBasePriceMapper.findSellerBasePriceList(ConditionVo);
	}

	@Override
	public int updateSellerBasePrice(BigDecimal basePrice, BigDecimal userId, String supplyId, String productId) {
	    SellerBasePriceVo sellerBasePrice = new SellerBasePriceVo();
        sellerBasePrice.setSupplyId(new BigDecimal(supplyId));
        sellerBasePrice.setUserId(userId);
        sellerBasePrice.setProductId(new BigDecimal(productId));
	    sellerBasePrice.setBasePrice(basePrice);
		return sellerBasePriceMapper.updateSellerBasePrice(sellerBasePrice);
	}

    @Override
    public int insertSellerBasePrice(String basePrice, String userId, String supplyId, String productId) {
        SellerBasePriceVo sellerBasePrice = new SellerBasePriceVo();
        sellerBasePrice.setSupplyId(new BigDecimal(supplyId));
        sellerBasePrice.setUserId(new BigDecimal(userId));
        sellerBasePrice.setProductId(new BigDecimal(productId));
        sellerBasePrice.setBasePrice(new BigDecimal(basePrice));
        return sellerBasePriceMapper.insertSellerBasePrice(sellerBasePrice);
    }

    @Override
    public int insertSellerBasePriceBatch(List<SellerBasePriceVo> list) {
        return sellerBasePriceMapper.insertSellerBasePriceBatch(list);
    }

    @Override
    public int updateSellerBasePriceBatch(List<SellerBasePriceVo> list) {
        return sellerBasePriceMapper.updateSellerBasePriceBatch(list);
    }
	
	

}
